package com.wmeimob.fastboot.jiubei.check;

import com.wmeimob.fastboot.jiubei.dto.GoodsDTO;
import com.wmeimob.fastboot.jiubei.entity.ShopOrderItems;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 美萌:hlx
 * @Date 2019/9/2 下午1:38
 */
@Component
public class ShopOrderCheck {

    public List<GoodsDTO> convertOrderItemsToGoodsInfo(List<ShopOrderItems> itemsList) {
        List<GoodsDTO> goodsList = new ArrayList<>();
        for (ShopOrderItems item : itemsList) {
            GoodsDTO goods = new GoodsDTO();
            goods.setGoodsId(item.getGoodsId());
            goods.setGoodsName(item.getGoodsName());
            goods.setStock(item.getSaleQuantity());
            goods.setSkuNo(item.getGoodsSkuNo());
            goodsList.add(goods);
        }
        return goodsList;
    }
}
